package net.fukure.android.pecabc.media;

import static com.googlecode.javacv.cpp.avcodec.*;
import android.graphics.Point;

public class EncodeType {
	public static boolean crop = true;
	static String[] portraitCamera = {
		"240x320",
		"240x320",
		"240x320",
		"480x640",
		"480x640",
		"480x640"
	};
	static String[] landscapeCamera = {
		"320x240",
		"320x240",
		"320x240",
		"640x480",
		"640x480",
		"640x480"
	};
	public static int getFramerate(boolean portrait, int i){
		if(i<3){
			return 10;
		}else{
			return 5;
		}
	}
	
	static int [] bitrate = {
			160,240,320,256,384,512
	};
	static int [] vcodec = {
			AV_CODEC_ID_WMV1,
			AV_CODEC_ID_WMV2,
			AV_CODEC_ID_WMV3
		};
	static int [] acodec = {
			AV_CODEC_ID_WMAV1,
			AV_CODEC_ID_WMAV2
		};

	public static Point getSize(int portrait, int i){
		if(portrait==1){
			return getSize(true, i);
		}else{
			return getSize(false, i);
		}
	}
	public static Point getSize(boolean portrait, int i){
		String[] camera = portrait ? portraitCamera : landscapeCamera;
		String[] wh = camera[i].split("x");
		int w = Integer.parseInt(wh[0]);
		int h = Integer.parseInt(wh[1]);
		return new Point(w, h);
	}
	
	public static int getBitrate(int i){
		return bitrate[i];
	}
	
	public static String getString(boolean portrait, int i) {
		Point p = getSize(portrait, i);
		if(portrait && crop){
			p.y = p.y/2;
		}
		return p.x+"x"+p.y+" "+bitrate[i]+"kbps";
	}
	
}
